SaraikinaVK 1 месяц назад
Родитель 703026b561
Сommit ee77396a6f

@ -83,31 +83,31 @@ print(eval(input('введите выражение для расчета = ')))
```py ```py
import os import os
os.getcwd() os.getcwd()
'/Users/dmitrijantonov/Desktop/POAC/python-labs/TEMA6' 'C:\Users\Yarik\Desktop\labi\python-labs\TEMA6'
Antonov = os.getcwd() Vera = os.getcwd()
print(Antonov) print(Vera)
/Users/dmitrijantonov/Desktop/POAC/python-labs/TEMA6 'C:\Users\Yarik\Desktop\labi\python-labs\TEMA6'
os.getcwd() os.getcwd()
'/Users/dmitrijantonov/Desktop/POAC/python-labs/TEMA6' 'C:\Users\Yarik\Desktop\labi\python-labs\TEMA6'
``` ```
- Пробую методы вложенного модуля path - Пробую методы вложенного модуля path
```py ```py
os.listdir() os.listdir()
['.DS_Store', 'hm', 'report.md', '.gitkeep'] ['.DS_Store', 'hm', 'report.md', '.gitkeep']
os.path.isdir('/Users/dmitrijantonov/Desktop/POAC/python-labs/TEMA6') os.path.isdir('C:\Users\Yarik\Desktop\labi\python-labs\TEMA6')
True True
os.path.isdir('python-labs/TEMA6') os.path.isdir('python-labs/TEMA6')
False False
os.path.abspath('report.md') os.path.abspath('report.md')
'/Users/dmitrijantonov/Desktop/POAC/python-labs/TEMA6/report.md' 'C:\Users\Yarik\Desktop\labi\python-labs\TEMA6/report.md'
file = os.path.abspath('report.md') file = os.path.abspath('report.md')
drkt=os.path.dirname(file) drkt=os.path.dirname(file)
drkt drkt
'/Users/dmitrijantonov/Desktop/POAC/python-labs/TEMA6' 'C:\Users\Yarik\Desktop\labi\python-labs\TEMA6'
os.path.basename(file) os.path.basename(file)
'report.md' 'report.md'
os.path.split(file) os.path.split(file)
('/Users/dmitrijantonov/Desktop/POAC/python-labs/TEMA6', 'report.md') ('C:\Users\Yarik\Desktop\labi\python-labs\TEMA6', 'report.md')
os.path.exists(file) os.path.exists(file)
True True
os.path.exists(file+'eee') os.path.exists(file+'eee')
@ -118,7 +118,7 @@ False
help(open) help(open)
fp=open(file=drkt+'//zapis1.txt',mode='w') fp=open(file=drkt+'//zapis1.txt',mode='w')
drkt drkt
'/Users/dmitrijantonov/Desktop/POAC/python-labs/TEMA6' 'C:\Users\Yarik\Desktop\labi\python-labs\TEMA6'
dir(fp) dir(fp)
['_CHUNK_SIZE', '__class__', '__del__', '__delattr__', '__dict__', '__dir__', '__doc__', '__enter__', '__eq__', '__exit__', '__format__', '__ge__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__next__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '_checkClosed', '_checkReadable', '_checkSeekable', '_checkWritable', '_finalizing', 'buffer', 'close', 'closed', 'detach', 'encoding', 'errors', 'fileno', 'flush', 'isatty', 'line_buffering', 'mode', 'name', 'newlines', 'read', 'readable', 'readline', 'readlines', 'reconfigure', 'seek', 'seekable', 'tell', 'truncate', 'writable', 'write', 'write_through', 'writelines'] ['_CHUNK_SIZE', '__class__', '__del__', '__delattr__', '__dict__', '__dir__', '__doc__', '__enter__', '__eq__', '__exit__', '__format__', '__ge__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__next__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '_checkClosed', '_checkReadable', '_checkSeekable', '_checkWritable', '_finalizing', 'buffer', 'close', 'closed', 'detach', 'encoding', 'errors', 'fileno', 'flush', 'isatty', 'line_buffering', 'mode', 'name', 'newlines', 'read', 'readable', 'readline', 'readlines', 'reconfigure', 'seek', 'seekable', 'tell', 'truncate', 'writable', 'write', 'write_through', 'writelines']
fp.close() fp.close()

Загрузка…
Отмена
Сохранить