Answers for "separator python"

24

split string python

file='/home/folder/subfolder/my_file.txt'
file_name=file.split('/')[-1].split('.')[0]
Posted by: Guest on April-01-2020
-2

sep in python

import time

def count_items(items):
    print('Counting ', end='', flush=True)
    num = 0
    for item in items:
        num += 1
        time.sleep(1)
        print('.', end='', flush=True)

    print(f'nThere were {num} items')
Posted by: Guest on February-06-2021

Python Answers by Framework

Browse Popular Code Answers by Language