微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

使用 Mojolicious::Lite (perl) - 我想将所有 PARAMS 列表放入一个简单的 @ARRAY

如何解决使用 Mojolicious::Lite (perl) - 我想将所有 PARAMS 列表放入一个简单的 @ARRAY

https:///getparam?h1=hello&h2=goodbye

get 'getparam' => sub {
  my $c = shift;
  print $c->param('h1') . "\n";       # THIS WORKS AS I WOULD EXPECT
  my @list_of_all_params = $c->param; # DOES NOT WORK and THIS IS WHAT I WOULD LIKE TO MAKE WORK
  return 1;
};

所以我真正想要的是@list_of_all_params 包含“h1”和“h2”,这是传递的参数 使用:https:///getparam?h1=hello&h2=goodbye

提前感谢大家!

解决方法

也许

import random
import time
def add(x,y):
    return x + y
def sub(x,y):
    return x - y
def abv(x):
    if int(x) < 0:
        return -x
    if int(x) >= 0:
        return x
def mul(x,y):
    return str(int(x)*int(y))
def div(x,y):
    return str(int(x)/int(y))
def max(x,y):
    if sx > y:
        return (str(x) + ' is greater than ' + str(y))
    if x < y:
        return (str(y) + ' is graeter than ' + str(x))
    if x == y:
        return 'its the same!'
def min(x,y):
    if x < y:
        return (str(x) + ' is smaller than ' + str(y))
    if x > y:
        return (str(y) + ' is smaller than ' + str(x))
    if x == y:
        return 'its the same!'
while True:
    print(" Welcome to simons calculator!\n")
    time.sleep(0.5)
    print('add to add\n')
    time.sleep(0.5)
    print('sub to subtract\n')
    time.sleep(0.5)
    print('abv for absolute value\n')
    time.sleep(0.5)
    print('mul to multiply\n')
    time.sleep(0.5)
    print('div to divide\n')
    time.sleep(0.5)
    print('max to find out which number is greater\n')
    time.sleep(0.5)
    print('min to find out which number is smaller\n')
    time.sleep(0.5)
    x = player = (input("whats your first number? :   "))
    time.sleep(0.5)
    y = player = (input("whats your second number? dont fill this one out if your going for absolute value just hit enter :   "))
    time.sleep(0.5)
    player = input('add sub abv mul div max min? which one? :     ')
    time.sleep(0.5)
    if player == 'add':
        player = input("your number is " + str(add(x,y))+ " enter to continue")
    if player == 'sub':
        player = input("your number is " + str(sub(x,y))+ " enter to continue")
    if player == 'mul':
        player = input("your number is " + str(mul(x,y))+ " enter to continue")
    if player == 'div':
        player = input("your number is " + str(div(x,y))+ " enter to continue")
    if player == 'max':
        player = input(str(max(x,y))+ " enter to continue")
    if player == 'min':
        player = input(str(min(x,y))+ " enter to continue")
    if player == 'abv':
        player = input("your number is " + str(abv(x))+ " enter to continue")
    else:
        player = input('you made a typo!')

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其他元素将获得点击?
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。)
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbcDriver发生异常。为什么?
这是用Java进行XML解析的最佳库。
Java的PriorityQueue的内置迭代器不会以任何特定顺序遍历数据结构。为什么?
如何在Java中聆听按键时移动图像。
Java“Program to an interface”。这是什么意思?