+ 1

Open() funsction

I thought the open() function was built in to python and you use it without having to import the os module. can someone help me with this code? >>> y = open("C:\Users\AAsus\Documents\what_up.txt", "r") SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape >>>

5th Mar 2017, 7:46 PM
Awah
3 Respostas
+ 1
thanks a lot
6th Mar 2017, 1:35 AM
Awah
0
you need to use \\, otherwise, it tells Python you want to have a Unicode character (for the \U)
5th Mar 2017, 10:44 PM
Amaras A
Amaras A - avatar
0
There are many built in functions, each of them use up some memory while a program is running. So that each program only uses a small amount of memory, you say which functions you're going to use with import. Otherwise all the functions would have to be imported just incase your program used them and every program would use gigabytes of memory.
13th May 2017, 11:24 PM
Edward Furey
Edward Furey - avatar