Advertisement
Technical_13

Untitled

Sep 16th, 2021
1,102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.34 KB | None | 0 0
  1. file1 = 'files/abc_xyz.py'
  2. file2 = 'files/def/abc_xyz.py'
  3.  
  4. result1 = file1.split( '.' )[ 0 ].split( '/' )[ 1 ]
  5. if result1.find( '_' ) != -1:
  6.     result1 = result1.split( '_' )[ 1 ]
  7. result2 = file2.split( '.' )[ 0 ].split( '/' )[ 1 ]
  8. if result2.find( '_' ) != -1:
  9.     result2 = result2.split( '_' )[ 1 ]
  10.  
  11. print( '"'+result1+'" and "'+result2+'"' )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement