日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

java 删除txt,如何从.txt文件中删除2个值

發布時間:2024/7/5 编程问答 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 java 删除txt,如何从.txt文件中删除2个值 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

if "A" in columns and int(columns[5]) < int(columns[3]):

print(columns)

print (columns[3]) - (columns[5])

我在這做錯了什么?不記得我最近開始編碼 .

這是完整的代碼:

import csv

FILE_NAME = "paintingJobs.txt" #I use this so that the file can be used easier

COL_HEADERS = ['Number', 'Date', 'ID', 'Total', 'Status', 'Paid']

NUM_COLS = len(COL_HEADERS)#This will insure that the header of each column fits into the length of the data

# read file once to determine maximum width of data in columns

with open(FILE_NAME) as f:

reader = csv.reader(f, delimiter=',')

# determine the maximum width of the data in each column

max_col_widths = [len(col_header) for col_header in COL_HEADERS]

for columns in reader:

for i, col in enumerate(columns):

if "A" in columns and int(columns[5]) < int(columns[3]):

max_col_widths[i] = max(max_col_widths[i], len(repr(col)))

# add 1 to each for commas

max_col_widths = [col_width+1 for col_width in max_col_widths]

# read file second time to display its contents with the headers

with open(FILE_NAME) as f:

reader = csv.reader(f, delimiter=',')

# display justified column headers

print(' ' + ' '.join(col_header.ljust(max_col_widths[i])

for i, col_header in enumerate(COL_HEADERS)))

# display justified column data

for columns in reader:

if "A" in columns and int(columns[5]) < int(columns[3]):

print(columns)

print (columns[3]) - (columns[5])`

這是我得到的錯誤:

line 72, in Option_B

print (columns[3]) - (columns[5])

TypeError:不支持的操作數類型 - :'NoneType'和'str'

總結

以上是生活随笔為你收集整理的java 删除txt,如何从.txt文件中删除2个值的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。