我需要为环境变量设置密码,但问题是密码包含尖锐符号,当我想使用这个变量时,只显示第一个尖锐符号。例如假设he#l#lo
是我的密码,当我将其设置为 时/etc/environment
,PASSWORD_API="he#l#lo"
我打印它只是显示he
并在之后留下字符#
。但是当我export PASSWORD_API="he#l#lo"
从终端使用时一切正常!通过添加环境变量有什么问题\etc\environment
我无法更改密码所以如果你有任何想法请帮助我。谢谢你
主页
/
user-960734
mehdi's questions
mehdi
Asked:
2019-08-02 04:25:27 +0800 CST
我想在python中将一个复杂的字符串写入一个文件,但问题是我的文本本身也有一个命令、双引号和单引号,所以python不能写它并假设它也是一个命令。例如,我想将以下文本写入 file.txt:
(b'[{\n "SourceFile": "/home/parsezan/work/hamclaasy-backend/media/3da78f6d-73a0-41d0-bca6-9b237ba13cdd/4550af6d-ac08-4d22-a80c-681bd171d295.jpg",\n "ExifToolVersion": 10.80,\n "FileName": "4550af6d-ac08-4d22-a80c-681bd171d295.jpg",\n "Directory": "/home/parsezan/work/hamclaasy-backend/media/3da78f6d-73a0-41d0-bca6-9b237ba13cdd",\n "FileSize": "112 kB",\n "FileModifyDate": "2019:08:01 16:42:27+04:30",\n "FileAccessDate": "2019:08:01 16:42:27+04:30",\n "FileInodeChangeDate": "2019:08:01 16:42:27+04:30",\n "FilePermissions": "rw-r--r--",\n "FileType": "JPEG",\n "FileTypeExtension": "jpg",\n "MIMEType": "image/jpeg",\n "JFIFVersion": 1.01,\n "ExifByteOrder": "Big-endian (Motorola, MM)",\n "Make": "HUAWEI",\n "Model": "CHM-U01",\n "Orientation": "Horizontal (normal)",\n "XResolution": 72,\n "YResolution": 72,\n "ResolutionUnit": "inches",\n "Software": "CHM-U01 V100R001C185B120",\n "ModifyDate": "2019:07:07 11:33:18",\n "YCbCrPositioning": "Centered",\n "DocumentName": "",\n "ExposureTime": "1/30",\n "FNumber": 2.0,\n "ExposureProgram": "Program AE",\n "ISO": 260,\n "ExifVersion": "0210",\n "DateTimeOriginal": "2019:07:07 11:33:18",\n "CreateDate": "2019:07:07 11:33:18",\n "ComponentsConfiguration": "Y, Cb, Cr, -",\n "ShutterSpeedValue": "1/30",\n "ApertureValue": 2.0,\n "BrightnessValue": 0,\n "ExposureCompensation": 0,\n "MeteringMode": "Average",\n "LightSource": "Daylight",\n "Flash": "Auto, Did not fire",\n "FocalLength": "3.8 mm",\n "MakerNoteUnknownText": "M[64] [e0,1] [ad,f5]",\n "UserComment": "Hisilicon Balong",\n "SubSecTime": 506779,\n "SubSecTimeOriginal": 506779,\n "SubSecTimeDigitized": 506779,\n "FlashpixVersion": "0100",\n "ColorSpace": "sRGB",\n "ExifImageWidth": 4160,\n "ExifImageHeight": 3120,\n "InteropIndex": "R98 - DCF basic file (sRGB)",\n "InteropVersion": "0100",\n "SensingMethod": "One-chip color area",\n "FileSource": "Digital Camera",\n "SceneType": "Directly photographed",\n "CustomRendered": "Custom",\n "ExposureMode": "Auto",\n "WhiteBalance": "Auto",\n "DigitalZoomRatio": 1,\n "FocalLengthIn35mmFormat": "27 mm",\n "SceneCaptureType": "Standard",\n "GainControl": "None",\n "Contrast": "Normal",\n "Saturation": "Normal",\n "Sharpness": "Normal",\n "SubjectDistanceRange": "Unknown",\n "OffsetSchema": 60,\n "DeviceSettingDescription": "(Binary data 4 bytes, use -b option to extract)",\n "Compression": "JPEG (old-style)",\n "ThumbnailOffset": 1134,\n "ThumbnailLength": 6358,\n "ImageWidth": 800,\n "ImageHeight": 600,\n "EncodingProcess": "Baseline DCT, Huffman coding",\n "BitsPerSample": 8,\n "ColorComponents": 3,\n "YCbCrSubSampling": "YCbCr4:2:0 (2 2)",\n "Aperture": 2.0,\n "ImageSize": "800x600",\n "Megapixels": 0.480,\n "ScaleFactor35efl": 7.1,\n "ShutterSpeed": "1/30",\n "SubSecCreateDate": "2019:07:07 11:33:18.506779",\n "SubSecDateTimeOriginal": "2019:07:07 11:33:18.506779",\n "SubSecModifyDate": "2019:07:07 11:33:18.506779",\n "ThumbnailImage": "(Binary data 6358 bytes, use -b option to extract)",\n "CircleOfConfusion": "0.004 mm",\n "FOV": "67.4 deg",\n "FocalLength35efl": "3.8 mm (35 mm equivalent: 27.0 mm)",\n "HyperfocalDistance": "1.70 m",\n "LightValue": 5.5\n}]\n', None)"
我尝试:
result = 'echo "{result}" >> file.txt'.format(result=str(raw_result))
subprocess.Popen(result,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
shell=True)
然后尝试将其更改为 dic:
result = 'echo "{result}" >> /home/parsezan/work/django.txt'.format(result=str({'result': str(raw_result)}))
subprocess.Popen(result,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
shell=True)
但没有人不工作。有什么想法吗?谢谢
mehdi
Asked:
2019-06-24 02:31:59 +0800 CST
我需要更改英特尔图形中的保留热键,以便我可以在 PyCharm 中使用它们。默认情况下Ctrl++ /在 Intel AltGraphic中使用,因此我需要在 Ubuntu 18.04 LTS 中更改它们。windows 只需打开并更改它们,但我在 Ubuntu 中找不到任何明确的方法。因为我是Linux的新手,请以某种方式解释以了解。RightLeftIntel graphic control panel
谢谢你
mehdi
Asked:
2019-05-30 00:08:18 +0800 CST