Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python file size

>>> import os
>>> b = os.path.getsize("/path/isa_005.mp3")
>>> b
2071611
Comment

python get size of file

import os

# get size in bytes
path = 'path/to/file.txt'
size = os.path.getsize(path)
Comment

Python program to get the file size of a plain file.

import os
filepath='file1.txt'
size=os.path.getsize(filepath)
print(str(size) + ' Bytes')
Comment

how to check the size of a file in python

import os
the_file_that_you_Want_to_check_the_size = os.path.getsize("The file Name")
print(the_file_that_you_Want_to_check_the_size)
# Your result #
Comment

python get size of file

import os
os.path.getsize('C:Python27Libgenericpath.py')
Comment

get file size python

>>> import os
>>> b = os.path.getsize("/path/isa_005.mp3")/ (1024*1024)
>>> b
Comment

python get file size

>>> from pathlib import Path
>>> Path('somefile.txt').stat()
#OUTPUT:
os.stat_result(st_mode=33188, st_ino=6419862, st_dev=16777220, st_nlink=1, st_uid=501, st_gid=20, st_size=1564, st_atime=1584299303, st_mtime=1584299400, st_ctime=1584299400)

>>> Path('somefile.txt').stat().st_size
#OUTPUT:
1564
Comment

get size of file python

>>> import os
>>> os.path.getsize("/path/to/file.mp3")
2071611 # output in bytes
Comment

PREVIOUS NEXT
Code Example
Python :: numpy fill na with 0 
Python :: how to create a keylogger in python 
Python :: random character generator python 
Python :: count number of matrix islands python 
Python :: how to create dataframe in python 
Python :: discord.py intents 
Python :: ctypes run as administrator 
Python :: get website content with beautifulsoup 
Python :: python virtual environment 
Python :: python get human readable file size 
Python :: month from datetime pandas 
Python :: get number of missing values dataframe 
Python :: python os if file exists 
Python :: pandas group by month 
Python :: make a zero list python 
Python :: datetime not defined python 
Python :: pip vs anaconda venv 
Python :: open website python 
Python :: dns request scapy 
Python :: python random 
Python :: matplotlib plot two graphs side by side 
Python :: median of a list python 
Python :: timedelta year python 
Python :: check if any value is null in pandas dataframe 
Python :: pandas drop zero values 
Python :: extract numbers from string python 
Python :: np array to df 
Python :: python set env var 
Python :: how to clear console in repl.it python 
Python :: count how many duplicates python pandas 
ADD CONTENT
Topic
Content
Source link
Name
1+3 =