I was trying to make a simple program. All it was suppose to do was create a file called noah.txt and write hello
to it then print the contents to it. But, when I ran it my computer started beeping and outputted nonsense:
0╥+☻ guru99.txt","w+") existing: f=open("guru99.txt", "a+")
f = open("noah.txt","w+")
f.write("hello")
fl = f.readlines()
for x in fl:
print(x)
ä Z d♫ e☺ j â☺ Z YZ♠ d
d☻ S(☼ sv Python Character Mapping Codec cp1252 generated from 'MAPPINGS/V
ENDORS/MICSFT/WINDOWS/CP1252.TXT' with gencodec.py.
i Nt♣ Codecc ☻ B s e Z☺ d d☺ ä☺ Z☻ d d☻ ä☺ Z♥ RS(♥ t♠
strictc♥ ♥ ♦ C s‼ t j☺ |☺ |☻ t☻ â♥ S(☺ N(♥ t♠ codecst♫ charma
p_encodet♫ encoding_table(♥ t♦ selft♣ inputt♠ errors( ( s# C:\
Python27\lib\encodings\cp1252.pyt♠ encode♂ s☻ ☺c♥ ♥ ♦ C s‼ t j
☺ |☺ |☻ t☻ â♥ S(☺ N(♥ R☻ t♫ charmap_decodet♫ decoding_table(♥ R♣ R
♠ R ( ( s# C:\Python27\lib\encodings\cp1252.pyt♠ decode♫ s☻ ☺
(♦ __name__t
__module__ R♂ ( ( ( s# C:\Python27\lib\encodings\cp1252.pyR
s♦ ♠☻♀♥t↕ IncrementalEncoderc ☻ B s¶ e Z☺ e☻ d ä☺
Z♥ RS(☺ c♥ ♥ ♦ C s→ t j☺ |☺ | j☻ t♥ â♥ d☺ ↓S(☻ Ni (♦ R☻ R
♥ R R♦ (♥ R♣ R♠ t♣ final( ( s# C:\Python27\lib\encodings\c
t♣ False ( ( ( s# C:\Python27\lib\encodings\cp1252.pyR♫ ◄
s☻ ♠☺t↕ IncrementalDecoderc ☻ B s¶ e Z☺ e☻ d ä☺ Z♥ RS(☺ c♥
♥ ♦ C s→ t j☺ |☺ | j☻ t♥ â♥ d☺ ↓S(☻ Ni (♦ R☻ R R R
(♥ R♣ R♠ R☼ ( ( s# C:\Python27\lib\encodings\cp1252.pyR♂ ▬
R► R♂ ( ( ( s# C:\Python27\lib\encodings\cp1252.pyR◄ § s☻
( ( ( s# C:\Python27\lib\encodings\cp1252.pyR↕ ↓ s☻ ♠☺t♀ S
( ( ( s# C:\Python27\lib\encodings\cp1252.pyR‼ ∟ s☻ ♠☺c
☼ C s@ t j☺ d☺ d☻ d♥ t☻ â j♥ d♦ t☻ â j♦ d♣ t♣ d♠ t♠ d t â S(
Nt♦ namet♠ cp125 R♂ t↕ incrementalencodert↕ incrementaldecodert♀
streamreadert♀ streamwriter( R☻ t CodecInfoR R♂
R♫ R◄ R‼ R↕ ( ( ( s# C:\Python27\lib\encodings\cp1252.pyt♂
getregentry! s► ☺ ☺♠☺♀☺♀☺♠☺♠☺♠☺uû☺ ☺☻♥♦ ♠
♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]
^_`abcdefghijklmnopqrstuvwxyz{|}~⌂Γé¼∩┐╛ΓÇÜ╞ÆΓÇ₧ΓǪΓÇáΓÇí╦åΓÇ░┼áΓÇ╣┼Æ∩┐╛┼╜∩┐╛∩┐╛
‘’“”•–—˜™š›œ￾žŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³
´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛ
├£├¥├₧├ƒ├á├í├ó├ú├ñ├Ñ├ª├º├¿├⌐├¬├½├¼├¡├«├»├░├▒├▓├│├┤├╡├╢├╖├╕├╣├║├╗├╝├╜├╛├┐(♂ t
__doc__R☻ R R♫ R◄ R↕ R‼ R← R
charmap_buildR♦ ( ( ( s# C:\Python27\lib\encodings\cp1252.py <
module>♥ s¶ ♠☻♀↓♦↓♦∟♥∟♣ ☼♠ ♦ R◄ R↕ ( ( s∟ C:\Python27\lib\
functools.pyR‼ = s c☻ ☻ ☻ S s↨ | |☺ k♦ p§ | |☺ k☻ ♀S(☺ N(
(☻ R◄ R↕ ( ( s∟ C:\Python27\lib\functools.pyR‼ > s c☻ ☻
☻ S s▬ | |☺ k♦ p§ | |☺ k☻ S(☺ N( (☻ R◄ R↕ ( ( s∟ C
:\Python27\lib\functools.pyR‼ ? s c☻ ☻ ☻ S s♂ | |☺ k♦ ♀S(☺ N
( (☻ R◄ R↕ ( ( s∟ C:\Python27\lib\functools.pyR‼ @ s c☻
☻ ☻ S s↨ | |☺ k♣ ♀p▬ | |☺ k☻ S(☺ N( (☻ R◄ R↕ ( ( s∟
C:\Python27\lib\functools.pyR‼ A s c☻ ☻ ☻ S s↨ | |☺ k♣ o▬ |
|☺ k☻ ♀S(☺ N( (☻ R◄ R↕ ( ( s∟ C:\Python27\lib\functools.pyR
‼ B s c☻ ☻ ☻ S s♂ | |☺ k♣ ♀S(☺ N( (☻ R◄ R↕ ( (
s∟ C:\Python27\lib\functools.pyR‼ C s s6 must define at least one o
rdering operation: < > <= >=( t♥ sett♥ dirt
ValueErrort♥ maxR♥ R t♥ intR♦ R♠ (♠ t♥ clst convertt♣ roo
tst♦ roott♠ opnamet♠ opfunc( ( s∟ C:\Python27\lib\functools.pyt♫
total_ordering5 s. ☻♥☺♀☺♀☺‼☺♀☺♀☺‼☺♀☺♀☺‼☺♀☺♀☺▬☻∟☺♠☺☼☺♀☺↨☺♀☺ ☺§☺↨☺c☺
☻ ♦ ♥ s d☺ t f☺ ç f☺ d☻ å â Y}☺ |☺ S(♥ s, Convert a cmp= func
tion into a key= functiont☺ Kc ☻ ☻
My code:
# new: f= open("guru99.txt","w+") existing: f=open("guru99.txt", "a+")
f = open("noah.txt","w+")
f.write("hello")
fl = f.readlines()
for x in fl:
print(x)
f.close()
Python: 2.7.9 (default, Dec 10 2014, 12:28:03) [MSC v.1500 64 bit (AMD64)]. Windows 7 64 bit. Why is this happening?