Python String Manipulation: Remove Leading Characters
You can use indexing and slicing to achieve this:
string = 'a\nb\nc\nalok'
new_string = string[6:] # start from index 6 (inclusive) till the end
print(new_string) # 'alok'
原文地址: https://www.cveoy.top/t/topic/lOMR 著作权归作者所有。请勿转载和采集!