vi /etc/gdm/custom.conf
[daemon]
WaylandEnable=flase
AutomaticLoginEnable=true
AutomaticLogin=$USERNAME
vi /etc/gdm/custom.conf
[daemon]
WaylandEnable=flase
AutomaticLoginEnable=true
AutomaticLogin=$USERNAME
apt-get update
#舊的
apt install net-tools iputils-ping ssh-tools inetutils-ping
#新的
apt install net-tools iputils-ping ssh-tools ipoute2
新增 /dev/sdb
fdisk /dev/sdb
n /dev/sdb1
lvm_id:8e
接下來新增至 (注意:新增硬碟擴充,類似raid0 有風險)
vgextend pve /dev/sdb1
lvextend /dev/pve/data /dev/sdb1
resize2fs /dev/pve/data
# python os.path.isfile() os.path.isdir() os.path.exists()
#https://shengyu7697.github.io/python-os-path-isdir/
#https://shengyu7697.github.io/python-os-path-isfile/
import os
dir="ppp"
print("—–確認目錄開始——")
#print(os.path.isdir(dir))
print ("os.path.isdir(範例)")
checkdir=os.path.isdir(dir)
if checkdir:
print("目錄存在")
else:
print("目錄不存在")
print ("os.path.exists(範例)")
checkdir=os.path.exists(dir)
if checkdir:
print("目錄存在")
else:
print("目錄不存在")
#確認檔案開始
print("—–確認檔案開始——")
print ("os.path.isfile(範例)")
files="jjj.txt"
checkfile=os.path.isfile(files)
if checkfile:
print("檔案存在")
else:
print("檔案不存在")
print ("os.path.exits(範例)")
files="jjj.txt"
checkfile=os.path.exists(files)
if checkfile:
print("檔案存在")
else:
print("檔案不存在")
python 安裝時 勾選 add all users path
path 記得選擇 c:\Python310\ 並加入 c:\Python310\ 和 c:\Python310\scripts
下載 https://bootstrap.pypa.io/get-pip.py
python get-pip.py
參考:
https://www.maxlist.xyz/2019/07/13/pip-install-python/
#file.py
import json as j
with open("config.json", mode="r", encoding="utf-8″) as f:
data=j.load(f)
print(data) #data 是一個字典
print ("name" + " :", data["name"])
print ("version" + " :", data["version"])
#修改寫入
data["name"]="New Name"
with open("config.json", mode="w", encoding="utf-8″)as f:
j.dump(data, f)
#在讀取
with open("config.json", mode="r", encoding="utf-8″) as f:
data=j.load(f)
print(data) #data 是一個字典
print ("name" + " :", data["name"])
print ("version" + " :", data["version"])
#file.py
with open("test.txt", mode="w", encoding="utf-8″) as file:
file.write("測試中文")
#如果檔案為utf8時,檔案第一列會有一個字元BOM,python encodeing=utf-8 列印時會有"\ufeff"輸出
# ,encoding 改為 utf-8-sig 讀取時會 去除 檔案抬頭 的 BOM
with open("test.txt", mode="r", encoding="utf-8-sig") as file:
data=file.read(2)
print(data)