H:3a="H:\2023"; print(a.replace("\\","/"))
H:2023a="H:\a2023"; print(a.replace("\\","/"))
H:/_2023a="H:\_2023"; print(a.replace("\\","/"))
On 29 Oct 2022, at 22:14, Bernard LEDRU <python@bernardledru.be> wrote:
Hello,
https://docs.python.org/3/library/stdtypes.html#string-methods
str.replace(old, new[, count])¶
Return a copy of the string with all occurrences of substring old replaced by new. If the optional argument count is given, only the first count occurrences are replaced.
Attention when the string contains the escape character.
Consider :
H:3a="H:\2023"; print(a.replace("\\","/"))
H:2023a="H:\a2023"; print(a.replace("\\","/"))
H:/_2023a="H:\_2023"; print(a.replace("\\","/"))
Best regards,
Bernard LEDRU
--
https://mail.python.org/mailman/listinfo/python-list
Hello,
https://docs.python.org/3/library/stdtypes.html#string-methods
str.replace(old, new[, count])¶
Return a copy of the string with all occurrences of substring old
replaced by new. If the optional argument count is given, only the first count occurrences are replaced.
Attention when the string contains the escape character.
Consider :
H:3a="H:\2023"; print(a.replace("\\","/"))
H:2023a="H:\a2023"; print(a.replace("\\","/"))
H:/_2023a="H:\_2023"; print(a.replace("\\","/"))
Hello,
https://docs.python.org/3/library/stdtypes.html#string-methods
str.replace(old, new[, count])¶
Return a copy of the string with all occurrences of substring old
replaced by new. If the optional argument count is given, only the first count occurrences are replaced.
Attention when the string contains the escape character.
Consider :
H:3a="H:\2023"; print(a.replace("\\","/"))
H:2023a="H:\a2023"; print(a.replace("\\","/"))
H:/_2023a="H:\_2023"; print(a.replace("\\","/"))
Best regards,
Bernard LEDRU
--
https://mail.python.org/mailman/listinfo/python-list
Hello,
https://docs.python.org/3/library/stdtypes.html#string-methods
str.replace(old, new[, count])¶
Return a copy of the string with all occurrences of substring old
replaced by new. If the optional argument count is given, only the first count occurrences are replaced.
Attention when the string contains the escape character.
Consider :
H:3a="H:\2023"; print(a.replace("\\","/"))
H:2023a="H:\a2023"; print(a.replace("\\","/"))
H:/_2023a="H:\_2023"; print(a.replace("\\","/"))
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 300 |
Nodes: | 16 (2 / 14) |
Uptime: | 68:38:39 |
Calls: | 6,712 |
Files: | 12,244 |
Messages: | 5,356,557 |