如何在Linux上使用Python导出 [英] How to use export with Python on Linux

查看:142
本文介绍了如何在Linux上使用Python导出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在Python中进行导出:

I need to make an export like this in Python :

# export MY_DATA="my_export"

我试图这样做:

# -*- python-mode -*-
# -*- coding: utf-8 -*-
import os
os.system('export MY_DATA="my_export"')

b
$ b

But when I list export, "MY_DATA" not appear :

# export

我如何使用Python导出而不将my_export保存到文件中?

How I can do an export with Python without saving "my_export" into a file ?

推荐答案

你其实是想做

import os
os.environ["MY_DATA"] = "my_export"

这篇关于如何在Linux上使用Python导出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆