简体   繁体   English

如何将文件数据从android发送到python?

[英]how can i send file data from android to python?

I want to send file of data from my android In other word { i want to Enter some data like name gender location age ....etc and this in android then take this data and send it to python } can this be file sending ?? 我想从我的android发送数据文件,换句话说{我想输入一些数据,例如姓名,性别,年龄,年龄.... etc,然后在android中输入,然后将其发送到python}这可以是文件发送吗? ? or it must be data ?!! 还是必须是数据?!

尝试使用Android脚本 ,您可以在Android上创建脚本层。

if it is an open sever socket then on the Android just use a client socket and send your data through. 如果是开放式服务器套接字,则在Android上只需使用客户端套接字并通过发送数据即可。 You'll have to decide what the format of the data is and how you will parse it but the commutation part is strait forward. 您必须决定数据的格式是什么以及如何解析它,但是换向部分是向前的。

// Create a socket without a timeout
try {
    InetAddress addr = InetAddress.getByName("java.sun.com");
    int port = 80;

    // This constructor will block until the connection succeeds
    Socket socket = new Socket(addr, port);
} catch (UnknownHostException e) {
} catch (IOException e) {
}

// Create a socket with a timeout
try {
    InetAddress addr = InetAddress.getByName("java.sun.com");
    int port = 80;
    SocketAddress sockaddr = new InetSocketAddress(addr, port);

    // Create an unbound socket
    Socket sock = new Socket();

    // This method will block no more than timeoutMs.
    // If the timeout occurs, SocketTimeoutException is thrown.
    int timeoutMs = 2000;   // 2 seconds
    sock.connect(sockaddr, timeoutMs);
} catch (UnknownHostException e) {
} catch (SocketTimeoutException e) {
} catch (IOException e) {
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从python中的url检索数据,然后将其发送到我可以从其处理以下数据的文件,这就是我如何检索数据 - How to retrieve data from a url in python and then send it to the file from which i can work on that data below is how i retrieve data 如何将数据从python脚本发送到Matplotlib? - How can I send data from a python script to Matplotlib? 如何将 Json 数据从 python 发送到 javascipt - How can I send Json Data from python to javascipt 我如何将一些数据从 php 发送到 python - how can i send some data from php to python 如何将数据从Python发送到Android App - How to send data from Python to Android App 如何将数据从 python 文件发送到数据库 - How to send data from a python file to a database 如果我将其包含在 Jinja 中,如何将变量数据从服务器(python 文件)发送到 html 文件? - How to send a variable data from server (python file) to an html file if I'm including it with Jinja? 如何从 Python 日志文件中删除额外的数据? - How can I remove extra data from Python logging file? 如何使用 Python 从本地文件生成数据 url? - How can I make a data url from a a local file with Python? 如何读取文本文件数据并发送到 python 中的电报机器人? - How can I read the text file data and send to telegram bot in python?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM