使用USERNAME代替每次更新用户ID

时间:2018-11-12 04:09:26

标签: python username

import csv, json

x = """[
        ....   I have data here
    ]"""

img_data = json.loads(x)

# I want to use %USERNAME% here instead of each time changing the qid for different users
outputFile = open("C:/Users/q666666/Desktop/JSON/imageData1.csv", "w")

csvwriter = csv.writer(outputFile)

csvwriter.writerow( ["fileName", "path", "annotatedImagePath", "resultFilePath", "numberOfDetectedObject", "numberOfQualifiedObject", "analysisDate", "hasFailed"] )

for row in img_data:
     csvwriter.writerow( [row["fileName"], row["path"], row["annotatedImagePath"], row["resultFilePath"], row["numberOfDetectedObject"], row["numberOfQualifiedObject"], row["analysisDate"], row["hasFailed"] ] )

outputFile.close()

1 个答案:

答案 0 :(得分:0)

您可以使用以下代码获取用户名并在路径中替换。但是,但是,您应该确保本地存储中存在命名文件夹。 Becoz,它不存在时不会创建根文件夹。

cordova plugin add cordova-plugin-ionic --save --variable APP_ID="myappid" --variable CHANNEL_NAME="Master" --variable UPDATE_METHOD="background"