Open() funsction | SoloLearn: Learn to code for FREE!


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

3/5/2017 7:46:50 PM


3 Answers

New Answer


thanks a lot


you need to use \\, otherwise, it tells Python you want to have a Unicode character (for the \U)


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.