小编Sah*_*pal的帖子

Python 语法问题 - TypeError: 未找到必需的参数“名称”(pos 1)

我试图按内容分隔一些文件,我的代码如下所示,并且不断向我显示错误。

__author__ = 'Sahil Nagpal'

from pyspark import SparkContext,SparkConf
from pyspark.sql import SparkSession


spark = SparkSession.builder.appName("GEOTRELLIS").getOrCreate()
sparkcont = SparkContext.getOrCreate(SparkConf().setAppName("GEOTRELLIS"))
logs = sparkcont.setLogLevel("ERROR")



imageFile = "/mnt/imagefile/IMGFileCopy.txt"
one_meter_File = "/mnt/imagefile/one_meter/one_meter_file.txt"
_13_File = "/mnt/imagefile/13_meter/_13_File.txt"
ned19_File = "/mnt/imagefile/ned19/ned19_File.txt"

#iterate over the file
try:
    with open(file=imageFile,mode="r+") as file, open(file=one_meter_File,mode='w+') as one_meter_File,open(file=_13_File,mode='w+') as _13_File,open(file=ned19_File,mode='w+') as ned19_File:

        for data in file.readlines():
            if("one_meter" in data):
                #writing the one_meter file
                one_meter_File.write(data)
            elif("_13" in data):
                # writing the _13 file
                _13_File.write(data)
            elif("ned19" in data):
                # writing the ned19 file
                ned19_File.write(data) …
Run Code Online (Sandbox Code Playgroud)

python io syntax python-2.x

3
推荐指数
1
解决办法
4210
查看次数

Python将大(10GB).csv转换为.tsv

python新手。想要将大型csv文件转换为tsv。

import re
with open("D:/AddressEvaluation/NAD/NAD.csv", 'r') as myfile:
with open("D:/NAD.txt", 'w') as csv_file:
for line in myfile:
  fileContent = re.sub(",", "\t", line)
  csv_file.write(fileContent)
Run Code Online (Sandbox Code Playgroud)

我想念什么吗?纠正我,如果我错了。

python csv file

-1
推荐指数
1
解决办法
4221
查看次数

标签 统计

python ×2

csv ×1

file ×1

io ×1

python-2.x ×1

syntax ×1