使用pyautogui.typewrite()w /特殊字符

时间:2018-02-28 16:49:50

标签: python pyautogui

import pyautogui
pyautogui.typewrite('Março')

它键入Maro(它跳过字符'ç')。

1 个答案:

答案 0 :(得分:0)

最好的解决方案是像这样使用 pyperclip。

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<table class="table">
    <tbody>
        <thead>
            <tr>
                <th>Name</th>
                <th>Price</th>
                <th>Qty</th>
                <th>Full price</th>
                <th>Actions</th>
            </tr>
        </thead>
        <tr>
            <td><input name="product[2][product_name]" class="product_name" value="Soda 2.5 (L)"></td>
            <td><input name="product[2][inprice]" class="price" value="17"></td>
            <td><input name="product[2][count]" class="count"  value="20"></td>
            <td><input name="product[2][fullprice]" class="fullprice"  value="340"></td>
            <td><a class="del-service" href="#" title="Click to remove this entry">Delete Row</a></td>
        </tr>
        <tr>
            <td><input name="product[3][product_name]" class="product_name" value="Macaroni 700 (Gr)"></td>
            <td><input name="product[3][inprice]" class="price" value="5"></td>
            <td><input name="product[3][count]" class="count" value="20"></td>
            <td><input name="product[3][fullprice]" class="fullprice" value="100"></td>
            <td><a class="del-service" href="#" title="Click to remove this entry">Delete Row</a></td>
        </tr>
        <tr>
            <td><input name="product[3][product_name]" class="product_name" value="Soda 1.5 (L)"></td>
            <td><input name="product[3][inprice]" class="price" value="9"></td>
            <td><input name="product[3][count]" class="count" value="20"></td>
            <td><input name="product[3][fullprice]" class="fullprice" value="180"></td>
            <td><a class="del-service" href="#" title="Click to remove this entry">Delete Row</a></td>
        </tr>
    </tbody>
</table>
<input id="total" value="620">

如果您使用的是 Linux 并且无法运行,则可能需要安装这些依赖项。

Debian def type_unicode(text): import pyautogui import pyperclip pyperclip.copy(text) pyautogui.hotkey("ctrl", "v") type_unicode("Março")

拱门 sudo apt-get install xclip

原创文章:

https://intellipaat.com/community/8484/python-automagica-unicode-text

https://pypi.org/project/pyperclip/