Python Forum
Last caracter of a string truncated issue when working from the end of the string
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Last caracter of a string truncated issue when working from the end of the string
#3
Rather than [-7:-1] to go to the end [-7:] -7 and the rest.
dst = (r"C:\Users\tekno\Documents\Client Drawings\AAA001")
dwg_name = dst[-7:]
print(dst)
print(dwg_name)
Output:
C:\Users\tekno\Documents\Client Drawings\AAA001 \AAA001
Teknohead23 likes this post
Reply


Messages In This Thread
RE: Last caracter of a string truncated issue when working from the end of the string - by Yoriz - Oct-03-2021, 12:30 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question [Beautiful Soup] Replace tag.string from another file? Winfried 0 106 Yesterday, 02:39 AM
Last Post: Winfried
  TypeError: string indices must be integers deneme2 2 676 Feb-14-2025, 12:23 AM
Last Post: deneme2
  How do I parse the string? anna17 8 2,157 Feb-13-2025, 07:08 AM
Last Post: michaeljordan
  question about changing the string value of a list element jacksfrustration 4 2,170 Feb-08-2025, 07:43 AM
Last Post: jacksfrustration
  How to read a file as binary or hex "string" so that I can do regex search? tatahuft 3 1,182 Dec-19-2024, 11:57 AM
Last Post: snippsat
  [SOLVED] Sub string not found in string ? jehoshua 4 1,434 Dec-03-2024, 09:17 PM
Last Post: jehoshua
  extracting from a string Stephanos 6 1,219 Oct-01-2024, 06:52 AM
Last Post: DeaD_EyE
  Unable to understand the function string.split() Hudjefa 8 2,574 Sep-16-2024, 04:25 AM
Last Post: Pedroski55
Question [SOLVED] How to replace characters in a string? Winfried 2 1,070 Sep-04-2024, 01:41 PM
Last Post: Winfried
  Destructor method adding in string chizzy101010 3 946 Sep-03-2024, 12:31 PM
Last Post: chizzy101010

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020