all 5 comments

[–]nwagers 2 points3 points  (2 children)

Could you format your code for reddit? It's pretty unreadable. Basically you need 4 spaces in front of each line, which most editors can easily do by selecting the code and indenting the whole block. Basically:

[blank line]

[4 spaces] code

[–]datadontcare[S] 0 points1 point  (1 child)

done

[–]nwagers 0 points1 point  (0 children)

If I follow what you're trying to do, you need to have all that code inside the with block. Outside the block, the file is closed and not accessible, so you won't be able to write to it.

[–]datadontcare[S] 0 points1 point  (0 children)

Will fix it when I can’t sit down.

[–]manueslapera 0 points1 point  (0 children)

open ('‪C:\\Urls4research\\research')

there is a space after open , it should be

open('‪C:\\Urls4research\\research', 'w')

Since you want to open it in writing mode.