update readme

This commit is contained in:
Nikolay Kim 2017-06-29 11:26:25 +06:00
parent afe2324ecc
commit 6b093af3d9
2 changed files with 4 additions and 4 deletions

View File

@ -43,11 +43,11 @@ fn main() {
fn hello(py: Python) -> PyResult<()> {
let sys = py.import("sys")?;
let version: String = sys.get("version")?.extract(py)?;
let version: String = sys.get("version")?.extract()?;
let locals = PyDict::new(py);
locals.set_item("os", py.import("os")?)?;
let user: String = py.eval("os.getenv('USER') or os.getenv('USERNAME')", None, Some(&locals))?.extract(py)?;
let user: String = py.eval("os.getenv('USER') or os.getenv('USERNAME')", None, Some(&locals))?.extract()?;
println!("Hello {}, I'm Python {}", user, version);
Ok(())

View File

@ -38,11 +38,11 @@ fn main() {
fn hello(py: Python) -> PyResult<()> {
let sys = py.import("sys")?;
let version: String = sys.get("version")?.extract(py)?;
let version: String = sys.get("version")?.extract()?;
let locals = PyDict::new(py);
locals.set_item("os", py.import("os")?)?;
let user: String = py.eval("os.getenv('USER') or os.getenv('USERNAME')", None, Some(&locals))?.extract(py)?;
let user: String = py.eval("os.getenv('USER') or os.getenv('USERNAME')", None, Some(&locals))?.extract()?;
println!("Hello {}, I'm Python {}", user, version);
Ok(())