[TriLUG] OT-ish: Python array slicing question

Steve Litt via TriLUG trilug at trilug.org
Mon Dec 12 17:39:12 EST 2022


Steve Litt via TriLUG said on Mon, 12 Dec 2022 17:32:36 -0500

>What's the best way of making a copy of a string?

Oh neva-mind, mere assignment does the job for strings:

===================================
#!/usr/bin/python3
st1='st1'
st2=st1
st2='st2'
print(st1)
print(st2)
===================================

Results:

st1
st2

Thanks,

SteveT

Steve Litt 
Autumn 2022 featured book: Thriving in Tough Times
http://www.troubleshooters.com/bookstore/thrive.htm


More information about the TriLUG mailing list