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
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