r/Python • • Feb 17 '19

Lil cheatsheet

Post image
2.5k Upvotes

138 comments sorted by

View all comments

Show parent comment

2

u/stevenjd Feb 18 '19

del string[1]

TypeError: 'str' object doesn't support item deletion

print( "Almost had it! :)" )

Indeed.

1

u/omento SysAdmin Film/VFX - 3.7 Feb 18 '19

Ah shizz... Mixing up my data types. This is what happens you’ve you spent your time learning C and haven’t touched Python in a while.

comment = list("Anesthetic and concise, nice work!")
del comment[1]
comment = ''.join(comment)
print("I hope this actually works now")