Skip to content
Advertisement

Load python notebook [closed]

I would like to load a text in python notebook that is undirected network.

f=open('C:...com-dblp.ungraph.txt','r')

it is does not work

error

Advertisement

Answer

You get unicode error because of the , it gives the next character a special meaning and in a regular string you’d need to escape with another (like 'C:\Users\micka\OneDrive Bureaubigdata\finalexam\com-dblp.ungraph.txt') In most cases it’s actually fine to use single forward slash in paths instead of a \ , Windows today and current python versions can handle paths like C:/Users/ just fine.

Though in your case it just leads to another issue: Google Colaboratory can’t access your local files. You have to manually upload it (find the folder-icon on the left pane, open it and drag-n-drop your files there) or check their IO Notebook for other options – https://colab.research.google.com/notebooks/io.ipynb

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement