Jump to content
DickDi

A simple question about python

Recommended Posts

Hello,everybody! I want to implement a very simple function by workflow. First, type the keyword as a trigger  and a number (for example decimal 23.45678) as a query. Then,  convert  it to 23.46(keep two decimal places). Finally, copy the consequence to the clipboard. It seems a really easy job.  But I don’t know how the query or arguments input and output through python. After searching answers for several hours, I can’t find similar demos from internet. It makes me a little depressed.

Could anybody do me a favor? Thanks so much!

Share this post


Link to post
1 hour ago, vitor said:

Welcome @DickDi,

 

Why python, can’t it be any language? Here’s a Workflow that does what you ask, in ruby.

It works! Thank you~~~😉

Sometimes Python seems to be more friendly than other language. And I prepare to rewrite the workflow for some other functions(easy calculations), hmm~~~😁

Share this post


Link to post
from __future__ import print_function 
print('{:.2f}'.format(42.022345545456))

Will return

42.02

You could you pyperclip to write to the clipboard or pass the object along to the Alfred clipboard object.

Dean Jackson's Alfred-Workflow library can handle the interface with Alfred if you need more complexity.

Share this post


Link to post
On 5/30/2019 at 5:50 AM, amoose136 said:

from __future__ import print_function 
print('{:.2f}'.format(42.022345545456))

Will return


42.02

You could you pyperclip to write to the clipboard or pass the object along to the Alfred clipboard object.

Dean Jackson's Alfred-Workflow library can handle the interface with Alfred if you need more complexity.

Thanks so much !

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...